package com.xyx.yfy_site_msg.system.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xyx.yfy_site_msg.system.entity.YfyNotice;
import com.xyx.yfy_site_msg.system.service.YfyNoticeService;
import com.xyx.yfy_site_msg.system.utils.DataGridView;
import com.xyx.yfy_site_msg.system.vo.YfyNoticeVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  受理相关数据控制器
 * </p>
 *
 * @author xyx
 * @since 2020-11-12
 */
@RestController
@RequestMapping("/notice")
public class YfyNoticeController {

    @Autowired
    private YfyNoticeService noticeService;

    /*
    * 查询所有受理数据
    * */
    @RequestMapping("loadAllNotice")
    public DataGridView loadAllNotice(YfyNoticeVo noticeVo){
        IPage<YfyNotice> page=new Page<>(noticeVo.getPage(),noticeVo.getLimit());
        QueryWrapper<YfyNotice> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotBlank(noticeVo.getNCustomer()),"N_Customer",noticeVo.getNCustomer());
        queryWrapper.like(StringUtils.isNotBlank(noticeVo.getNOpername()),"N_Opername",noticeVo.getNOpername());
        queryWrapper.orderByDesc("N_Createtime");
        this.noticeService.page(page,queryWrapper);
        return new DataGridView(page.getTotal(),page.getRecords());
    }

}
